package com.wanlian.router.ui.main.yun;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.widget.TextView;

import com.wanlian.router.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Hyu on 2018/10/10.
 * Email: fvaryu@163.com
 */
public class DeleteDialog extends Dialog {

    @BindView(R.id.tv_title)
    TextView tv_title;

   private String fileName;

    private OnClickListener mOnClickListener;

    public void setOnClickListener(OnClickListener onClickListener) {
        mOnClickListener = onClickListener;
    }

    public DeleteDialog(@NonNull Context context) {
        super(context, R.style.UpgradeDialog);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_delete);

        ButterKnife.bind(this);

    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    @Override
    protected void onStart() {
        super.onStart();
        tv_title.setText(String.format("确定删除文件“%s”么?", fileName));
    }

    @OnClick(R.id.tv_cancel)
    void cancel_() {
        dismiss();
    }

    @OnClick(R.id.tv_next)
    void next(){
        if (mOnClickListener != null) {
            mOnClickListener.onClick(this, 0);
        }
    }

}
